import axios from 'axios';
import { toast } from 'sonner';

export const api = axios.create({
  baseURL: 'https://u13-crm-test.gexarus.com',
  // baseURL: 'https://u13-mrc.gexarus.com',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  }
});

api.interceptors.response.use(
  (response) => {
    if (response.data.success !== 'ok') toast.error(`${response.data.err.toUpperCase()} 😢`);
    return response;
  },
  (error) => {
    toast.error(error);
  }
);
